import requests
import chardet
r = requests.get('http://www.baidu.com')
print 'content----->' + r.content
print 'text-------->' + r.text
print 'encoding---->' + r.encoding

r.encoding = 'utf-8'

print 'new text---->' + r.text


print chardet.detect(r.content)
r.encoding = chardet.detect(r.content)['encoding']
print r.text